package com.ysw.validator.dynamic_validator;

import com.google.common.collect.Lists;
import org.apache.commons.lang3.math.NumberUtils;
import org.hibernate.validator.spi.group.DefaultGroupSequenceProvider;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName EmployeeGroupSequeceProvider
 * @Description TODO
 * @Author ysw
 * @Date 2022/5/13 20:29
 */
public class EmployeeGroupSequeceProvider implements DefaultGroupSequenceProvider<Employee> {

    @Override
    public List<Class<?>> getValidationGroups(Employee employee) {
        List<Class<?>> defaultGroupSequece = Lists.newArrayList();
        defaultGroupSequece.add(Employee.class);
        if (null != employee && employee.getSex()!=null && employee.getSex() == 1) {
            defaultGroupSequece.add(Employee.GirlGroup.class);
        }else if(null != employee && employee.getSex()!=null && employee.getSex() == 2){
            defaultGroupSequece.add(Employee.BoyGroup.class);
        }
        return defaultGroupSequece;
    }
}